package handlers

import amqp "github.com/rabbitmq/amqp091-go"

type ICmdHandler interface {
	Handle(cmd string) error
}

func NewHandlerFactory(cmd string, ch *amqp.Channel) ICmdHandler {
	switch cmd {
	case "heartbeat":
		return &HeartbeatHandler{
			onlineClients: make(map[string]string),
			ch:            ch,
		}
	case "chatmsg":
		return &MessageHandler{
			ch: ch,
		}
	}
	return nil
}
